<template>
	<view class="page-main">
		<x-navbar :title="'新对话'" autoBack>
			<view class="slot" slot="navbarRight"></view>
		</x-navbar>
		<view class="top-card">
			<image class="ic" src="/static/img/robot.png" mode="aspectFit" />
			<view class="title">Hi，我是万车宝AI汽修机器人-小万</view>
			<view class="desc">我可以帮你解答汽车故障问题、使用万车宝帮你检测车辆、通过大数预测你车辆未来可能出现的问题等，请把你的任务交给我吧！</view>
		</view>
		<view class="voice-text">
			<view class="label">识别语音内容:</view>
			<text>{{ voiceText }}</text>
		</view>
		<view v-if="false" class="middle-card">
			<view v-if="prompts.length > 0" class="prompt-warp">
				<view class="prompt-item" v-for="(prompt, index) in prompts" @click="chatPrompt(prompt)">
					<view class="label">
						<text>{{ prompt }}</text>
					</view>
				</view>
			</view>
		</view>
		<voiceBotton @ />
	</view>
</template>

<script>
import voiceBotton from './components/voiceBotton.vue';
export default {
	components: { voiceBotton },
	data() {
		return {
			hasQuestion: false,
			voiceText: '',
			prompts: ['刹车异响怎么办？', '帮我给车做个OBD检测', '给我说说我这辆车的常见问题?', '更多能力']
		};
	},
	onLoad() {
		uni.$on('XUNFEI_TEXT_CHANGE', this.oniFlyTextChange);
		uni.$on('XUNFEI_TEXT_COMPLETED', this.oniFlyTextCompleted);
	},
	onUnload() {
		uni.$off('XUNFEI_TEXT_CHANGE', this.oniFlyTextChange);
		uni.$off('XUNFEI_TEXT_COMPLETED', this.oniFlyTextCompleted);
	},
	methods: {
		oniFlyTextChange(text) {
			this.voiceText = text;
		},
		oniFlyTextCompleted(text) {
			this.voiceText = text;
		},
		chatPrompt(question) {},
		gotoRecord() {}
	}
};
</script>

<style lang="scss" scoped>
@import 'newChat.scss';
</style>
